package com.shuyun.springboot.amqp;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Created by feng.ding on 2017/1/11.
 */
@Component
public class Receiver {

   /* @RabbitListener(queues = "my-queue")
    public void receiveMessage(String message){
        System.out.println("Received <" + message + ">");
    }*/

    @RabbitListener(queues = "myqueue")
    public void receiveMsg(Message message){
        byte[] msg = message.getBody();
        System.out.println("收到消息: '" + new String(msg) + "'");
    }
}
